import { request } from '@/request'

export const register = <T extends object, R = any>(
  data: T
): Promise<IResponse<R>> => {
  return request.POST<T>({ url: '/auth/register', params: data })
}

export const login = <T extends object, R = any>(
  data: T
): Promise<IResponse<R>> => {
  return request.POST<T>({ url: '/auth/login', params: data })
}

export const updateUser = <T extends object, R = any>(
  data: T
): Promise<IResponse<R>> => {
  return request.POST<T>({ url: '/users/edit', params: data })
}

// 获取房屋列表
export const getHouses = <T extends object, R = any>(
  data: T
): Promise<IResponse<IList<R>>> => {
  return request.GET({ url: '/house/list', params: data })
}
